
package fileby.ctrl.actions.impl;

import fileby.core.SourceType;
import fileby.model.ISourceHandler;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.KeyStroke;

/**
 *
 * @author Jacob
 */
class NewTabAction extends AbstractAction {

    private ISourceHandler sourceHandler;

     public NewTabAction(ISourceHandler sourceHandler) {
        super("New Tab", null);
        this.sourceHandler = sourceHandler;
        putValue(SHORT_DESCRIPTION, "Create a new tab");
        putValue(MNEMONIC_KEY, KeyEvent.VK_N);
        putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_DOWN_MASK));
    }

    public void actionPerformed(ActionEvent e) {
        sourceHandler.newSource(SourceType.COMPUTER);
    }

}
